// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "refactor/common-refactor.scss" as deprecated;

.context-notification {
  --context-notification-bg-color: var(--alert-background-color-default);
  --context-notification-fg-color: var(--alert-text-foreground-color-default);
  --context-notification-icon-color: var(--alert-icon-foreground-color-default);
  --context-notification-border-color: var(--alert-border-color-default);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: deprecated.$s-16 1fr;
  gap: deprecated.$s-8;
  min-height: deprecated.$s-32;
  height: fit-content;
  width: 100%;
  padding: deprecated.$s-8;
  border: deprecated.$s-1 solid var(--context-notification-border-color);
  border-radius: deprecated.$br-8;
  background-color: var(--context-notification-bg-color);
}

.warning {
  --context-notification-bg-color: var(--alert-background-color-warning);
  --context-notification-fg-color: var(--alert-text-foreground-color-warning);
  --context-notification-icon-color: var(--alert-icon-foreground-color-warning);
  --context-notification-border-color: var(--alert-border-color-warning);
}

.success {
  --context-notification-bg-color: var(--alert-background-color-success);
  --context-notification-fg-color: var(--alert-text-foreground-color-success);
  --context-notification-icon-color: var(--alert-icon-foreground-color-success);
  --context-notification-border-color: var(--alert-border-color-success);
}

.info {
  --context-notification-bg-color: var(--alert-background-color-info);
  --context-notification-fg-color: var(--alert-text-foreground-color-info);
  --context-notification-icon-color: var(--alert-icon-foreground-color-info);
  --context-notification-border-color: var(--alert-border-color-info);
}

.default {
  --context-notification-bg-color: var(--alert-background-color-default);
  --context-notification-fg-color: var(--alert-text-foreground-color-default);
  --context-notification-icon-color: var(--alert-icon-foreground-color-default);
  --context-notification-border-color: var(--alert-border-color-default);
}

.error {
  --context-notification-bg-color: var(--alert-background-color-error);
  --context-notification-fg-color: var(--alert-text-foreground-color-error);
  --context-notification-icon-color: var(--alert-icon-foreground-color-error);
  --context-notification-border-color: var(--alert-border-color-error);
}

.icon {
  @extend .button-icon;
  align-self: self-start;
  stroke: var(--context-notification-icon-color);
}

.context-text {
  @include deprecated.bodySmallTypography;
  align-self: center;
  color: var(--context-notification-fg-color);
  margin: auto 0;
}

// The second rule only applies when the element receives embedded
// links within the content by means of the dangerouslySetInnerHTML.
// Only in this case the contain-html class will be used.

.link,
.contain-html .context-text a {
  @include deprecated.bodySmallTypography;
  align-self: center;
  display: inline;
  text-align: left;
  height: deprecated.$s-16;
  margin: 0;
  color: var(--modal-link-foreground-color);
}
